import java.util.Scanner;

public class 星期
{

	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		System.out.println("Enter year:(e.g., 2012): ");
		int year = in.nextInt();
		System.out.println("Enter month:1-12: ");
		int month = in.nextInt();
		int n = 1;
		if(month==1)
		{
			month=13;
			year--;
		}

		if(month==2)
		{
			month=14;
			year--;
		}
		System.out.println("Enter thr day of month:1-31: ");
		int day = in.nextInt();
		int  h = ((day+26*(month+1)/10+year%100+year%100/4+year/100/4+5*year/100)%7);
		if (h==0)
			System.out.println("Day of the week is Saturday");
		if (h==1)
			System.out.println("Day of the week is sunday");
		if (h==2)
			System.out.println("Day of the week is Monday");
		if (h==3)
			System.out.println("Day of the week is Tuesday");
		if (h==4)
			System.out.println("Day of the week is Wensday");
		if (h==5)
			System.out.println("Day of the week is Thursday");
		if (h==6)
			System.out.println("Day of the week is Friday");
		System.out.printf("%d",n);

	}
}
